#include <iostream>
#include <string>
#include <vector>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
using namespace std;
using namespace boost;


mutex io_mu;
void printing(int& x,const string str)
{
    for (int i = 0;i < 5;++i)
    {
        mutex::scoped_lock lock(io_mu);
        cout << str << ++x <<endl;
    }
}

int main()
{
    int x = 0;
    thread t1(printing,x,"hello");
    thread t2(printing,x,"boost");

    cout << t1.get_id()<<endl;
    cout << thread::hardware_concurrency()<<endl;
    this_thread::sleep(posix_time::seconds(2));

    return 0;

}
